Adding some more judges, here and there.
[and.git] / COCI / 2010-2011 / Contest #1 - 22.10.2010 / x3 / x3.cpp
blob459a422841137d3061d42bcd0950d6918d1822b2
1 // Andrés Mejía
2 using namespace std;
3 #include <algorithm>
4 #include <iostream>
5 #include <iterator>
6 #include <numeric>
7 #include <sstream>
8 #include <fstream>
9 #include <cassert>
10 #include <climits>
11 #include <cstdlib>
12 #include <cstring>
13 #include <string>
14 #include <cstdio>
15 #include <vector>
16 #include <cmath>
17 #include <queue>
18 #include <deque>
19 #include <stack>
20 #include <list>
21 #include <map>
22 #include <set>
24 #define foreach(x, v) for (typeof (v).begin() x=(v).begin(); x !=(v).end(); ++x)
25 #define For(i, a, b) for (int i=(a); i<(b); ++i)
26 #define D(x) cout << #x " is " << x << endl
28 const double EPS = 1e-9;
29 int cmp(double x, double y = 0, double tol = EPS) {
30 return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
33 int times[32][2];
35 int main(){
36 int n; cin >> n;
37 while (n--) {
38 unsigned int k; cin >> k;
39 for (int t = 0; t < 32; ++t) {
40 times[t][k & 1]++;
41 k >>= 1;
44 long long ans = 0;
45 long long pow = 1;
46 for (int t = 0; t < 32; ++t) {
47 ans += pow * times[t][0] * times[t][1];
48 pow <<= 1;
50 cout << ans << endl;
51 return 0;